@import 'scss-imports/variables';

$singlecolumn-max-width: ($card-width-slim + $gap * 2);
$dualcolumn-slim-max-width: ($card-width-slim * 2 + $gap * 2);
$scrollbar-offset: 20px;

$level-offset: 24px;
$padding-left: 8px;

:host {
  display: block;
}

.table-container {
  box-sizing: border-box;
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-right: 16px;
  max-width: $table-width;
  min-width: $table-min-width;
  position: relative;
}

.tree-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-bottom: 1.5rem;
  overflow: auto;
}

.tree-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: fit-content;

  @media (max-width: $breakpoint-tablet) {
    min-height: fit-content;
    min-width: unset;
    overflow-x: auto;
  }

}

.loader-bar {
  height: 2px;
  position: absolute;
  top: 0;
  z-index: 3;
}

.spacer {
  display: block;
  flex-grow: 0;
  width: 40px;
}

.tree-header {
  align-items: center;
  border-bottom: 2px solid var(--lines);
  color: var(--fg2);
  display: grid;
  grid-gap: 8px;
  grid-template-columns: auto 100px 100px 100px 100px 100px 70px;
  min-height: 48px;
  min-width: fit-content;
  padding-left: 48px;
  width: 100%;

  @media (max-width: $breakpoint-tablet) {
    grid-template-columns: 45px auto 0 0 0 0 0 0;
    width: auto;
  }

  @media (min-width: $breakpoint-singlecolumn) {
    grid-template-columns: auto 100px 100px 100px 100px 100px 70px;
    overflow-x: hidden;
  }

  > div {
    font-weight: bold;
    padding: 4px 0;

    @media (max-width: $breakpoint-tablet) {
      display: none;
    }

    &:first-child {
      background: linear-gradient(90deg, var(--bg1) 0%, var(--bg1) calc(100% - 13px), transparent 100%);
      left: 0;
      padding-left: $padding-left;
      padding-right: 15px;
      position: sticky;

      @media (max-width: $breakpoint-tablet) {
        display: block;
      }
    }
  }
}

.nested-tree-root-node {
  align-items: center;
  border-bottom: 1px solid var(--lines);
  display: flex;
  position: relative;

  &:hover {
    background-color: var(--hover-bg);
  }
}

:host ::ng-deep {
  button.ix-tree-node-toggle {
    margin-left: 5px;
  }

  ix-bootenv-node-item {
    padding-left: 5px;
  }
}
